package org.example.Mapper;

import org.apache.ibatis.annotations.*;
import org.example.pojo.User;
import java.util.List;

@Mapper
public interface UserMapper {


    /*
     * 查询所有数据
     * */
    public List<User> findAll();

    /*
    * 根据ID删除用户信息
    * */
    @Delete("delete from user where id=#{id}")
    public Integer deleteById(Integer id);


    /*
    * 添加用户
    * */
    @Insert("insert into user(username,password,name,age) values(#{username},#{password},#{name},#{age})")
    public Integer insert(User user);

    /*
    * 修改用户信息
    * */
    @Update("update user set username =#{username}, password = #{password}, name = #{name}, age = #{age} where id = #{id}")
    public Integer update(User user);


    /*
    * 根据用户名和密码查询用户信息
    * */
    @Select("select* from user where username = #{username} and password = #{password}")
    public User selectByIdAndPassword(@Param("username") String username, @Param("password") String password);










}
